home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_6.lha / 7_6 / 7_6_prev.c < prev    next >
Text File  |  1993-08-08  |  493b  |  30 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / Get the previous entry from a list,
  6. / moving curr backwards.
  7. nt dlist::prev(ent &a)
  8.  
  9.    if (!last)
  10. return 0;
  11.  
  12.    // move curr backwards, possibly to
  13.    // the beginning or end of the list.
  14.    if (curr)
  15. if (curr == last->next)
  16.     {
  17.     curr = 0;
  18.     return 0;
  19.     }
  20.  
  21. else
  22.     curr = curr->prev;
  23.  
  24.    else
  25. curr = last;
  26.  
  27.    a = curr->e;
  28.    return 1;
  29.  
  30.